<!-- 我方签约主体控件 -->
<template>
  <a-space direction="vertical" style="width: 100%">
    <a-select
      v-model="modelValue"
      placeholder="请选择"
      @click="getCompany"
      :field-names="fieldName"
      :options="company.list"
    />
  </a-space>
</template>

<script lang="ts" setup>
  import { ref, computed, onMounted, reactive } from 'vue';
  import miiter from '@/utils/mitt';
  import { GetPersonnelinformation } from '@/api/home/System settings/personal-information';

  const props = withDefaults(
    defineProps<{
      props: { [propName: string]: any };
      name?: string;
      required?: boolean;
      oneValue: any;
      regex?: {
        [name: string]: {
          role: any;
          name: any;
        };
      };
    }>(),
    {}
  );

  const emit = defineEmits(['update:oneValue']);
  const modelValue = computed({
    get() {
      return props.oneValue;
    },
    set(val) {
      emit('update:oneValue', val);
    },
  });

  const company = reactive<any>({
    list: [],
  });
  const fieldName = { value: 'id', label: 'name' };
  // 获取人员信息
  const getCompany = async () => {
    try {
      const res = await GetPersonnelinformation({
        page: 0,
        size: -1,
      });
      company.list = res.content.data;
    } catch (error: unknown) {
      console.log(error);
    }
    // let data = res.Department.filter((item: any) => {
    //   return item.pid === 0;
    // });
    // companyName.value = data[0].name;
  };
  getCompany();
</script>

<style scoped lang="less"></style>
